#ifndef TEACHFORM_H
#define TEACHFORM_H

#include "models/command.h"
#include "webrtc/webrtcwidget.h"
#include <QTableWidget>
#include <QWidget>
#include <models/teachmodel.h>

namespace Ui {
class TeachForm;
}

class TeachForm : public QWidget
{
    Q_OBJECT

public:
    explicit TeachForm(QWidget *parent = nullptr);
    ~TeachForm();
    void initListViewStyle();
    void initVideoStyle();
    void showTeachList(int nIndex);
private slots:
    void on_add_btn_clicked();
    void on_preview_btn_clicked();//预览
    void on_exec_btn_clicked();//开始/停止
    void onTimeOut();
    void on_teach_table_widget_cellClicked(int row, int column);

private:
    Ui::TeachForm *ui;
    TeachModel* m_pTeachModel;
    int  m_nCurIndex=0;
    QList<VideoInfo> m_listVideoInfo;
    QVector <VideoBase*> m_vtVideoWidget;
    QVector<float*> m_vJoints;
    float m_fSubResult[31]={0};
    int m_nIndex=0;
    QTimer* m_pTimer= nullptr;
protected:
    void showEvent(QShowEvent *event);
    void calculateAverageNumbers(const QVector<float>& starts, const QVector<float>& ends, int n);
};

#endif // TEACHFORM_H
